<?php /*a:2:{s:65:"/www/wwwroot/cloud_boss/application/admin/view/equipment/add.html";i:1604050254;s:64:"/www/wwwroot/cloud_boss/application/admin/view/public/basic.html";i:1573743224;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title><?php echo htmlentities((isset($title) && ($title !== '')?$title:'重庆优合一众')); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/plugs/layui/css/layui.css" media="all"/>
    <!--<link rel="stylesheet" href="/static/layuicms/css/index.css" media="all" />-->
    
</head>
<body class="<?php echo htmlentities((isset($body) && ($body !== '')?$body:'childrenBody')); ?>">

<link rel="stylesheet" href="/static/css/admin/public.css" media="all"/>
<style>
    .tip{
        color: red;
    }
    .gray-tip {
        font-family: sans-serif !important;
        font-weight: 10 !important;
        margin-top: 5px !important;
        color: #A8A8A8 !important;
    }
    .layui-table td, .layui-table th {
        padding: 9px 4px;
    }
    .newupload{
        width: 100px !important;
        height: 40px !important;
        background: url(/static/image/admin/nopic.png) no-repeat;
        background-size: 100% 100%;
        border:none;
        overflow: hidden;
        cursor: pointer;
        position: relative;
        text-align: center;
    }
    .newInput{
        width: 80px !important;
    }
    .webuploader-container input {
        width: 100%;
        height: 100%;
    }

    .webuploader-pick {
        width: 100%;
        height: 100%;
        border: 1px solid blue;
    }
    .thumbBox {
        position: relative;
    }
    .thumbBox input{
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        opacity: 0;
        cursor: pointer;
    }
</style>
<form id="form" class="layui-form" style="width:80%;">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">基本信息</li>
        </ul>
        <div class="layui-tab-content ">
            <!--基本信息-->
            <div class="layui-tab-item layui-show">
                <input type="hidden" id="app_sn" value="<?php echo htmlentities($app_sn); ?>"/>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">设备编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="device_no" class="layui-input device_no" lay-verify="required" value="<?php echo htmlentities((isset($data['device_no']) && ($data['device_no'] !== '')?$data['device_no']:'')); ?>" placeholder="请输入设备编号">
                    </div>
                </div>
                <div class="layui-form-item layui-row layui-col-xs12">
                    <label class="layui-form-label">主板型号</label>
                    <div class="layui-input-block">
                        <select name="model_id" class="model_id" lay-filter="userGrade">
                            <?php if(!empty($mainboard)): foreach($mainboard as $k => $v): ?>
                                <option value="<?php echo htmlentities($v['mainboard_id']); ?>" <?php if(!empty($data) && $data['model_id'] == $v['mainboard_id']): ?>selected<?php endif; ?>><?php echo htmlentities($v['model']); ?></option>
                                <?php endforeach; ?>
                            <?php endif; ?>
                        </select>
                    </div>
                </div>

                <input type="hidden" class="id" name="id" value="<?php echo htmlentities((isset($data['id']) && ($data['id'] !== '')?$data['id']:'')); ?>">
            </div>

        </div>
    </div>


    <div class="layui-form-item layui-row layui-col-xs12">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-sm" lay-submit="" id="addUser">确定</button>
            <button type="reset" class="layui-btn layui-btn-sm layui-btn-primary">取消</button>
        </div>
    </div>
    </div>
</form>


<script type="text/javascript" src="/static/plugs/jquery/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="/static/plugs/layui/layui.js"></script>
<script type="text/javascript" src="/static/admin.js"></script>
<script type="text/javascript" src="/static/js/admin/api.js"></script>

<script type="text/javascript" src="/static/layuicms/layui/layui.js"></script>
<script type="text/javascript" src="/static/plugs/webuploader.min.js"></script>

<script>

    layui.use(['form','layer','layedit','upload','element'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            laypage = layui.laypage,
            upload = layui.upload,
            layedit = layui.layedit,
            element = layui.element,
            $ = layui.jquery;

        //一些事件监听
        element.on('tab(demo)', function (data) {
            console.log(data);
        });

        /**
         * 新增以及编辑后台用户
         */
        $("#addUser").click(function () {
            var url = '<?php echo url("$thisClass/add"); ?>';
            var data = {
                id: $(".id").val(),
                model_id: $(".model_id").val(),
                //model_id:$('#model_id option:selected').val(),
                device_no: $(".device_no").val(),
                app_sn: $("#app_sn").val(),
            };
            $.ajax({
                url: url,
                method:"POST",
                data: data,
                success:function(res){
                    if(res.code ==1){
                        layer.msg(res.msg,{icon: 1});
                        setTimeout(function(){
                            //刷新父页面
                            parent.location.reload();
                        },500);

                    }else{
                        layer.msg(res.msg);
                    }
                }
            });
            return false;
        });

        form.render();

    });


</script>

</body>
</html>